tokio-stdin-stdout
AsyncRead/AsyncWrite stdin/stdout for Tokio
Documentation - more description there
Example
let mut core = new?;
let stdin = stdin;
let stdout = stdout;
core.run?;
Additional examples
loop.rs
- Write hello ten timesline-by-line.rs
- Convert all input text to ASCII upper case, line by line. This example also demonstrates usage of tokio-codec and various modes of starting Tokio programs (multithreaded, singlethreaded).
async fn demo
Not much related to tokio-stdin-stdout, but there are some async fn
examples runnable by cargo script
.
They require nightly Rust.
- loop example as async fn v1 - The same as loop.rs above, but may be more readable.due to async fn backed by futures_await crate.
- line-by-line example as async fn v1 - The same as line-by-line.rs, but more prodecural-looking.
- loop example as async fn v3 - Another try with loop.rs, but this time using new async engine built-in in Rust itself. As it intrefaces early alpha code, it may stop working after a while.
Alternatives
- tokio-stdin no AsyncRead, only stdin, byte by byte
- tokio-file-unix - better, but only Unix